<?php 
class User_libs extends CI_Session{
    private $obj;
    function  __construct(){
        parent::__construct();
        $this->obj =& get_instance();
        $this->obj->load->model('backend/user_model');
    }
    // Kiem tra dang nhap chua
    function isLogin(){
        if($this->obj->session->userdata('userid') && $this->obj->session->userdata('userid') != ''
            && $this->obj->session->userdata('username') && $this->obj->session->userdata('username') != '')
            return true;
        else return false;
    }
    // Kiem tra la admin khong
    function isAdmin(){
        $info = $this->obj->user_model->getInfo($this->obj->session->userdata('userid'));
        if($info['level'] == 2) return true;
        else return false;
    }
}